package com.yidu.service.serviceImpl;

import com.yidu.entity.Menu;
import com.yidu.mapper.MenuMapper;
import com.yidu.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class MenuServiceImpl implements MenuService {
    @Autowired
    MenuMapper menuMapper;
    @Override
    public List<Menu> selectMenu(int page, int limit) {
        Map map = new HashMap();
        System.out.println(page);
        map.put("page",(page-1)*limit);
        map.put("limit",(page-1)*limit+limit);
        return menuMapper.selectMenu(map);
    }

    @Override
    public void insertMenu(Menu menu) {
        menuMapper.insertMenu(menu);
    }

    @Override
    public void updateMenu(Menu menu) {
        menuMapper.updateMenu(menu);
    }

    @Override
    public void deleteMenu(int menuId) {
        menuMapper.deleteMenu(menuId);
    }
}
